# -*- coding = utf-8 -*-
# @Time      : 2020/10/14 17:13
# @Author    : Reanon
# @File      : testBs4.py
# @Email     : dafo360@gmail.com
# @Software  : PyCharm

"""
BeautifulSoup4将复杂HTHL_令档转换成一个复杂的树形结构，每个节点都是Python对象，所有对象I乂归纳为种:

- Tag
- NavigableString
- BeautifulSoup
- comment
"""

# 正则表达式

# 读取文件内容

from bs4 import BeautifulSoup

file = open("./baidu.html", "rb")
html = file.read()
# 定义解析html,指定解析器html.parser
bs = BeautifulSoup(html, "html.parser")


t_list = bs.select(".mnav ~ .bri")
print(t_list[0].get_text())

# for item in t_list:
#     print(item)
